{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div style=\"color:#777777;background-color:#ffffff;font-size:12px;text-align:right;\">\n",
    "\tprepared by Abuzer Yakaryilmaz (QuSoft@Riga) | November 07, 2018\n",
    "</div>\n",
    "<table><tr><td><i> I have some macros here. If there is a problem with displaying mathematical formulas, please run me to load these macros.</i></td></td></table>\n",
    "$ \\newcommand{\\bra}[1]{\\langle #1|} $\n",
    "$ \\newcommand{\\ket}[1]{|#1\\rangle} $\n",
    "$ \\newcommand{\\braket}[2]{\\langle #1|#2\\rangle} $\n",
    "$ \\newcommand{\\inner}[2]{\\langle #1,#2\\rangle} $\n",
    "$ \\newcommand{\\biginner}[2]{\\left\\langle #1,#2\\right\\rangle} $\n",
    "$ \\newcommand{\\mymatrix}[2]{\\left( \\begin{array}{#1} #2\\end{array} \\right)} $\n",
    "$ \\newcommand{\\myvector}[1]{\\mymatrix{c}{#1}} $\n",
    "$ \\newcommand{\\myrvector}[1]{\\mymatrix{r}{#1}} $\n",
    "$ \\newcommand{\\mypar}[1]{\\left( #1 \\right)} $\n",
    "$ \\newcommand{\\mybigpar}[1]{ \\Big( #1 \\Big)} $\n",
    "$ \\newcommand{\\sqrttwo}{\\frac{1}{\\sqrt{2}}} $\n",
    "$ \\newcommand{\\dsqrttwo}{\\dfrac{1}{\\sqrt{2}}} $\n",
    "$ \\newcommand{\\onehalf}{\\frac{1}{2}} $\n",
    "$ \\newcommand{\\donehalf}{\\dfrac{1}{2}} $\n",
    "$ \\newcommand{\\hadamard}{ \\mymatrix{rr}{ \\sqrttwo & \\sqrttwo \\\\ \\sqrttwo & -\\sqrttwo }} $\n",
    "$ \\newcommand{\\vzero}{\\myvector{1\\\\0}} $\n",
    "$ \\newcommand{\\vone}{\\myvector{0\\\\1}} $\n",
    "$ \\newcommand{\\vhadamardzero}{\\myvector{ \\sqrttwo \\\\  \\sqrttwo } } $\n",
    "$ \\newcommand{\\vhadamardone}{ \\myrvector{ \\sqrttwo \\\\ -\\sqrttwo } } $\n",
    "$ \\newcommand{\\myarray}[2]{ \\begin{array}{#1}#2\\end{array}} $\n",
    "$ \\newcommand{\\X}{ \\mymatrix{cc}{0 & 1 \\\\ 1 & 0}  } $\n",
    "$ \\newcommand{\\Z}{ \\mymatrix{rr}{1 & 0 \\\\ 0 & -1}  } $\n",
    "$ \\newcommand{\\Htwo}{ \\mymatrix{rrrr}{ \\frac{1}{2} & \\frac{1}{2} & \\frac{1}{2} & \\frac{1}{2} \\\\ \\frac{1}{2} & -\\frac{1}{2} & \\frac{1}{2} & -\\frac{1}{2} \\\\ \\frac{1}{2} & \\frac{1}{2} & -\\frac{1}{2} & -\\frac{1}{2} \\\\ \\frac{1}{2} & -\\frac{1}{2} & -\\frac{1}{2} & \\frac{1}{2} } } $\n",
    "$ \\newcommand{\\CNOT}{ \\mymatrix{cccc}{1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 0 & 0 & 1 & 0} } $\n",
    "$ \\newcommand{\\norm}[1]{ \\left\\lVert #1 \\right\\rVert } $"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2>Quantum Coin Flipping</h2>\n",
    "\n",
    "Welcome to quantum world :) \n",
    "\n",
    "We will do a series of experiments, and try to understand the behaviours of \"particles\" in quantum world."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h3> The first experiment</h3>\n",
    "\n",
    "We will trace the behaviour of a photon.\n",
    "\n",
    "For quantum coin-flipping, we use a beam splitter.\n",
    "\n",
    "For measurements, we use two photon detectors.\n",
    "\n",
    "<ul>\n",
    "    <li> Photon is our coin. </li>\n",
    "    <li> Beam splitter flips the photon. </li>\n",
    "    <li> Photon detectors are our eyes.</li>\n",
    "</li>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> The setup </h4>\n",
    "\n",
    "</b>We send photons to a beam splitter as shown below.\n",
    "\n",
    "We expect two behaviours: the beam splitter either transmits or reflects the photon.\n",
    "\n",
    "<img src=\"../images/photon1.jpg\" width=\"50%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> Experimental results </h4>\n",
    "\n",
    "After many experiments, we observe the photons in each photon detector almost evenly ($ \\approx \\% 50 $ and $ \\approx \\% 50 $).\n",
    "\n",
    "<img src=\"../images/photon2.jpg\" width=\"50%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> The first interpretation </h4>\n",
    "\n",
    "So, the affect of a beam splitter is similar to fair coin.\n",
    "\n",
    "<ul>\n",
    "    <li> Head (state 0): Trasmitted </li>\n",
    "    <li> Tail (state 1): Reflected </li>\n",
    "</ul>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> Model </h4>\n",
    "\n",
    "Thus, let's describe our first experiment by a single (probabilistic) bit.\n",
    "\n",
    "We start in state 0.\n",
    "\n",
    "With half probability, the photon transmits, and the state does not change.\n",
    "\n",
    "With half probability, the photon is reflected, and the state is flipped.\n",
    "\n",
    "<img src=\"../images/photon3.jpg\" width=\"50%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h3> The second experiment </h3>\n",
    "\n",
    "Let's extend our experiment with two mirrors and another beam splitter.\n",
    "\n",
    "Then try to confirm our <u>interpretation</u> and <u>model</u>."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../images/photon4.jpg\" width=\"60%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, we have three photon detectors.\n",
    "\n",
    "By using our model described above, we expect to observe a photon \n",
    "<ul> \n",
    "    <li> in $ A $ with probability $ 0.5 $, </li>\n",
    "    <li>  and in $ B1 $ and $ B2 $ with probabilities $ 0.25 $. </li>\n",
    "</ul>\n",
    "\n",
    "Thus, our prediction for the frequencies of observing the photons in $ A $, $ B1 $, and $ B2 $ are respectively\n",
    "\n",
    "$$\n",
    "    \\approx \\% 50, \\approx \\% 25, \\mbox{ and } \\approx \\% 25. \n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> Experimental results </h4>\n",
    "\n",
    "Experiments confirm our predictions.\n",
    "\n",
    "Our model could explain the second experiment."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../images/photon5.jpg\" width=\"65%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h3> The third experiment </h3>\n",
    "\n",
    "In the third experiment, we remove the photon detector $ A $.\n",
    "\n",
    "So we have only the detectors $ B1 $ and $ B2 $. \n",
    "\n",
    "<img src=\"../images/photon6.jpg\" width=\"65%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> Our prediction </h4>\n",
    "\n",
    "The third setup is similar to flipping a fair coin twice.\n",
    "\n",
    "Our prediciton is to observe the photons in $ B1 $ and $ B2 $ almost evenly ($ \\approx \\% 50 $ and $ \\approx \\% 50 $)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4>Let's do the math of our prediction</h4>\n",
    "\n",
    "0) At the initial step, we are in state $ 0 $. If we use our vector representation, it is\n",
    "\n",
    "$$ v_0 = \\myvector{1 \\\\ 0}. $$\n",
    "\n",
    "1) We flip a fair coin. The new probabilistic state is expected to be in both states ($0$ and $1$) with half probability ($ \\frac{1}{2} = 0.5 $).\n",
    "\n",
    "$$\n",
    "    v_1 = \\myvector{\\frac{1}{2} \\\\ \\frac{1}{2}}\n",
    "    = \\mymatrix{cc}{ \\frac{1}{2} & \\frac{1}{2} \\\\ \\frac{1}{2} & \\frac{1}{2} }  \n",
    "    \\myvector{1 \\\\ 0}.\n",
    "$$\n",
    "\n",
    "Here the transitions of a fair coin can be represented by the matrix (table): $ \\mymatrix{cc}{ \\frac{1}{2} & \\frac{1}{2} \\\\ \\frac{1}{2} & \\frac{1}{2} }    $ . \n",
    "\n",
    "2) Then, we flip a fair coin again. The new probabilistic state will be the same:\n",
    "\n",
    "$$\n",
    "    v_2 = \\myvector{\\frac{1}{2} \\\\ \\frac{1}{2}} = \n",
    "    \\mymatrix{cc}{ \\frac{1}{2} & \\frac{1}{2} \\\\ \\frac{1}{2} & \\frac{1}{2} }  \n",
    "    \\myvector{\\frac{1}{2} \\\\ \\frac{1}{2}}.\n",
    "$$\n",
    "\n",
    "<b><i> Our predicition is fine with mathematical calculation. </i></b>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../images/prediction1.jpg\" width=\"50%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h4> Experimental results </h4>\n",
    "\n",
    "<b style=\"color:red;\">However, the experiments results do not confirm our prediction.<b>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../images/photon7.jpg\" width=\"65%\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We observe the photons <b>only</b> in the detector $ B1 $, and we <b>never</b> observe any photon in the detector $ B2 $.\n",
    "\n",
    "<b> How could this be possible?</b>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    We have just observed how the classical physics (Newtonian mechanics) fails to explain quantum world!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We need a new way of explanation, called <u>quantum mechanics</u>.\n",
    "\n",
    "We can explain our experiments by using quantum mechanics.\n",
    "\n",
    "Welcome again to quantum world :-)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
